var MONITORING_SERVER_URL = 'http://localhost:13694/';
var pageViewInfo;
var pageId;

$(function () {

    jQuery.support.cors = true;
    $.connection.hub.url = MONITORING_SERVER_URL + 'signalr';
    var monitoringtHub = $.connection.monitoringtHub;

    monitoringtHub.addMessage = function (connection) {
        //alert(connection);
    };

    $.connection.hub.start({jsonp: true}).done(function () {

        pageViewInfo = {
            connectionId: $.connection.hub.id,
            screen: {
                width: window.screen.width,
                height: window.screen.height,
                availWidth: window.screen.availWidth,
                availHeight: window.screen.availHeight,
                availLeft: window.screen.availLeft,
                availTop: window.screen.availTop,
                colorDepth: window.screen.colorDepth,
                pixelDepth: window.screen.pixelDepth
            },
            url: $(location).attr('href'),
            clientUsername: 'hasan',// clientUsername,
            pageViewId: 0,
            clientLoadDuration: 100,
            serverLoadDuration: 200
        };

        monitoringtHub.sendPageViewInfo(pageViewInfo).done(function (pageViewId) {
            pageViewInfo.pageId = pageViewId;
        });

    });

});